package com.talking.activities

import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Typeface
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import androidx.appcompat.app.AppCompatActivity
import com.talking.App
import com.talking.activities.main.MainActivity
import com.talking.databinding.ActivitySplashBinding

@SuppressLint("CustomSplashScreen")
class SplashActivity : AppCompatActivity() {
    private lateinit var binding: ActivitySplashBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivitySplashBinding.inflate(layoutInflater)
        setContentView(binding.root)
        binding.splashLogo.logo.typeface = Typeface.createFromAsset(assets, "font1.TTF")
        binding.splashMoto.typeface = Typeface.createFromAsset(assets, "font1.TTF")
        Handler(Looper.myLooper()!!).postDelayed({
            if (App.sp.getBoolean("canautologin",false)){
                startActivity(Intent(this, MainActivity::class.java))
            }else{
                startActivity(Intent(this, LoginActivity::class.java))
            }
            finish()
        }, 1000)
    }
}